package com.taxigang.client.uibinder;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.Widget;
import com.taxigang.client.Session;
import com.taxigang.client.micro.TaxiGangCreator;
import com.taxigang.client.ui.map.MapView.PanelType;
import com.taxigang.client.uibinder.TaxiGangRoute.CreateMode;
import com.taxigang.client.uibinder.base.CreateStep;

public class CreateStep2b extends CreateStep {

	private static CreateStep2bUiBinder uiBinder = GWT
			.create(CreateStep2bUiBinder.class);

	interface CreateStep2bUiBinder extends UiBinder<Widget, CreateStep2b> {
	}

	@UiField
	Button backButton;

	@UiField
	Button okButton;
	
	@UiField
	Label headerLabel;

	@UiField
	Label whereExactlyLabel;

	@UiField TextArea messageTextArea;
	

	public CreateStep2b() {
		initWidget(uiBinder.createAndBindUi(this));
		bindUI();
		okButton.setText(TaxiGangCreator.taxiGangConstants.cont());
		headerLabel.setText(TaxiGangCreator.taxiGangConstants.step2());
		whereExactlyLabel.setText(TaxiGangCreator.taxiGangConstants.whereWillYouMeet());

	}
	
	

	private void bindUI() {
		bindControlButtons(backButton,PanelType.CREATE_STEP1);
		okButton.addClickHandler(new ClickHandler() {
			
			@Override
			public void onClick(ClickEvent event) {
				taxiGangRoute.setCreateMode(CreateMode.MEET_AT_RANK);
				String message = messageTextArea.getText();
				Session.getInstance().getSearchTaxiGangInfo().setMeetingMessage(message);
				taxiGangRoute.show(PanelType.CREATE_STEP4);
				
			}
		});

	}

	
}
